package cn.imvc.app.repositories;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import cn.imvc.app.entities.Comments;

public interface CommentsRepository extends JpaRepository<Comments, Integer> {
	/**
	 * 根据goodsId获取分页评论
	 * 
	 * @param goodsId
	 * @return
	 */
	Page<Comments> findByGoodsId(Integer goodsId, Pageable pageable);

	/**
	 * 根据goodsId获取指定状态 分页评论
	 * 
	 * @param goodsId
	 * @param state
	 * @return
	 */
	Page<Comments> findByGoodsIdAndState(Integer goodsId, byte state, Pageable pageable);

	/**
	 * 根据skuId获取分页评论
	 * 
	 * @param goodsSkuId
	 * @return
	 */
	Page<Comments> findByGoodsSkuId(Integer goodsSkuId, Pageable pageable);

	/**
	 * 根据goodsSkuId获取指定状态 分页评论
	 * 
	 * @param goodsSkuId
	 * @param state
	 * @return
	 */
	Page<Comments> findByGoodsSkuIdAndState(Integer goodsSkuId, byte state, Pageable pageable);
}
